#include <cstdio>

int main()
{
    int self, mather, m;
    self = 0;
    mather = 0;
    for(int i=1; i<=12; ++i)
    {
        scanf("%d",&m);
        self = self + 300;
        self = self - m;

        if( self < 0 )
        {
            printf("-%d",i);
            return 0;
        }

        while(self >= 100)
        {
            mather = mather + 100;
            self = self - 100;
        }
    }

    double ans = self + (double)mather * 1.2;
    printf("%.0lf", ans);
    return 0;
}